.model small
.stack 100h
.data
	msg0 db 'Programa atspausdina eilutes simboliu ASCII kodus astuntaine sistema' ,13,10, '$' 
	msg1 db 'Eilute: ' ,13,10, '$'
	msg3 db 'Rezultatas: ' ,13,10, '$'
	msg4 db ' $'
	msg5 db 'Jus nieko neivedete $'
	eil db 254,255 dup (?)


.code
start:
	mov ax,@data
	mov ds,ax
	
	mov ah, 09h
	mov dx, offset msg0
	int 21h
	
	mov ah, 09h
	mov dx, offset msg1
	int 21h

	mov dx, offset eil
	mov ah, 0ah
	int 21h
    

	mov ah, 09h
	mov dx, offset msg3
	int 21h
       

	mov si, offset eil
	xor cx, cx
	inc si
	mov al, [si]
	cmp al, 0
	je exit
	mov ah,0
	mov cx,ax

	call intoOct
	
	mov ah,4ch
	int 21h
exit:
	mov ah, 09h
	mov dx, offset msg5
	int 21h
	mov ah,4ch
	int 21h



intoOct proc 
   pradzia:
	xor ax,ax
	inc si
	mov al,[si]	
	mov ah,0h
	
	push cx
	xor cx,cx
	mov bx,8
   
   dalyba:	
	xor dx,dx
	div bx
	push dx
	inc cx
	cmp ax,0
        jne dalyba

   rodyti:
	xor dx,dx
	mov ah,02h
	pop dx
	add dx,30h
	int 21h
	dec cx
	cmp cx,0
        jne rodyti
	
	pop cx

	mov ah, 09h
	mov dx, offset msg4
	int 21h
	
	dec cx
	cmp cx,0

        jne pradzia

	ret

intoOct endp

rasymas proc
	push ax
	mov ah,09h
	int 21h
	pop ax
	ret
rasymas endp

end start

 


